// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Structural definition of AXI4Lite channel bundles

package bottlerocket

import chisel3._
import freechips.rocketchip
import rocketchip.util.GenericParameterizedBundle
import rocketchip.amba.ahb.AHBBundleParameters

class AHBMasterBundle(params: AHBBundleParameters) extends GenericParameterizedBundle(params)
{
  // Control signals from master to arbiter
  val hmastlock = Output(Bool())
  // Flow control from arbiter to master
  val hready    = Input(Bool())
  // A-phase signals from master to arbiter
  val htrans    = Output(UInt(width = params.transBits.W))
  val hsize     = Output(UInt(width = params.sizeBits.W))
  val hburst    = Output(UInt(width = params.burstBits.W))
  val hwrite    = Output(Bool())
  val hprot     = Output(UInt(width = params.protBits.W))
  val haddr     = Output(UInt(width = params.addrBits.W))
  // D-phase signals from master to arbiter
  val hwdata    = Output(UInt(width = params.dataBits.W))
  // D-phase response from arbiter to master
  val hresp     = Input(Bool())
  val hrdata    = Input(UInt(width = params.dataBits.W))
}

object AHBMasterBundle
{
  def apply(params: AHBBundleParameters) = new AHBMasterBundle(params)
}


